package flowdroid;

import flowdroid.scan.MethodChecker;
import flowdroid.taint.MyProvider;
import tuple.TupleManager;

import java.io.IOException;
import java.io.PrintStream;

import static util.Constant.getApkNameFromApkFilepath;

/**
 * Thanks to this test, it helps me avoid a key mistake. PermissionFlow.runConditionFlow() is not reliable.
 */
@Deprecated
public class TestPermissionFlow {
    static void test() throws Exception {
        // 1. 初始化变量
        String apkFileLocation = "/home/fyl/project/code/AndroPrivacyConsistency/data/apk/RQ2/SimpleMobileTools-file-manager-fdroid-6.16.1.apk";
        String androidJarPlatform = "/home/fyl/project/code/AndroPrivacyConsistency/libs/platforms";
        String dumpDir = "/home/fyl/project/code/AndroPrivacyConsistency/data/dump";

        try {
            String outFile = dumpDir + "/test.out";
            // 添加 PrintStream 字段
            PrintStream fileOut = new PrintStream(outFile);
            System.setOut(fileOut); // 重定向 System.out 到文件
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        MyProvider myProvider = new MyProvider();
        TupleManager manager = new TupleManager(getApkNameFromApkFilepath(apkFileLocation), TupleManager.State.COND, dumpDir);
        MethodChecker marker = new MethodChecker();
    }


    public static void main(String[] args) {
        try {
            test();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
